<template>
	<view class="me">
		<view class="avatar">
			<image :src="avatar" mode="widthFix"></image>
		</view>
		<view class="username">
			欢迎您！{{username}}
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex'
	export default {
		computed:mapState(['id','avatar','username']),
		data() {
			return {
			}
		},
		created(){
					//判断是否已经登录
					if(this.$store.state.id == ''){
						//跳转登录页面
						uni.redirectTo({
							url:'/pages/login/login'
						})
					}
		},
		methods: {
			
		}
	}
</script>

<style>
	.me{
		text-align: center;
	}
	.avatar image{
		width: 200rpx;
		border-radius: 50%;
	}

</style>
